package com.jrx.anytxn.investor.mapper.ext;

import com.jrx.anytxn.investor.entity.AmDelinquencyInvestorInfo;
import com.jrx.anytxn.investor.mapper.base.AmDelinquencyInvestorInfoMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @program: anytxn-cf-transaction
 * @description:
 * @author: xiaoyu.jing
 * @date: 2020-05-25 19:24
 **/
public interface ExtAmDelinquencyInvestorInfoMapper extends AmDelinquencyInvestorInfoMapper {

    List<AmDelinquencyInvestorInfo> selectByLoanIdAndStatus(String loanId, String customerId, String tenantId, String accountStatus);

    void batchUpdate(List<AmDelinquencyInvestorInfo> updateDelqList);

    /**
     * 根据状态查询延滞账户
     *
     * @param accountStatus 账户状态
     * @return List<AmDelinquencyInvestorInfo> 延滞账户信息
     * @author liuyang
     * @date 2020-05-26
     */
    List<AmDelinquencyInvestorInfo> selectByAccountStatus(@Param("accountStatus") String accountStatus);

    /**
     * 根据条件查询延滞账户信息
     *
     * @param investorLoanId 出资方贷款id
     * @param customerId     客户id
     * @param tenantId       租户id
     * @param billingTenor   期数
     * @param status         账户状态
     * @return AmDelinquencyInvestorInfo 延滞账户信息
     * @author liuyang
     * @date 2020-05-27
     */
    AmDelinquencyInvestorInfo selectDelqInfo(@Param("investorLoanId") String investorLoanId,
                                             @Param("customerId") String customerId,
                                             @Param("tenantId") String tenantId,
                                             @Param("billingTenor") Integer billingTenor,
                                             @Param("status") String status);

    /**
     * 批量更新延滞账户信息（作用于批量）
     *
     * @param amDelinquencyInfos 延滞账户信息
     * @return int 更新的条数
     * @author liuyang
     * @date 2020-05-27
     */
    int batchUpdateDelinquencyForBatch(List<AmDelinquencyInvestorInfo> amDelinquencyInfos);

    /**
     * 批量保存延滞账户信息
     *
     * @param saveDelqList 延滞账户信息
     * @return int 插入的条数
     * @author liuyang
     * @date 2020-05-27
     */
    int batchInsertDelinquency(List<AmDelinquencyInvestorInfo> saveDelqList);

    List<AmDelinquencyInvestorInfo> findByCust(@Param("customerId") String customerId,
                                               @Param("tenantId") String tenantId,
                                               @Param("status") String status);
}
